#include "SceneGraph.h"
#include <GL/glut.h>

MatrixTransform::MatrixTransform(){
	M = new Matrix4();
	C_new = new Matrix4();
	M->identity();
}

MatrixTransform::MatrixTransform(Matrix4 *m){
	M = new Matrix4();
	C_new = new Matrix4();
	M->set(m->get());
}

void MatrixTransform::draw(Matrix4* C, Texture *t) {
	if(animateEnabled) animate();
	C_new->set(C->get());
	C_new->multiply(M->get());
	for(int i = 0; i < next; i++){
	glPushMatrix();
		children[i]->draw(C_new, t);
		children[i]->animateEnabled = animateEnabled;
	glPopMatrix();
	}
}
